<div class="loader"></div>
{{ Form::open(array('url' => $base, 'id' => 'form', 'files' => true)) }}
	<div class="form-group">
		{{ Form::label('type', $form_type) }}
		<select name="type" class="form-control" id="type">
		@foreach($uploads as $key=>$upload)
			<option value="{{ $key }}"> {{ $upload['text'] }}</option>
		@endforeach
		</select>
		<span class="error text-danger" id="error_type"></span>
	</div>
	<div class="form-group">
		{{ Form::label('format', $form_format) }}
		<div id="upload-format">...</div>	
	</div>
	<div class="form-group">
		{{ Form::label('original_filename', $form_file) }}
		{{ Form::file('original_filename', [ 'class' => 'form-control'] ) }}
		<span class="error text-danger" id="error_original_filename"></span>
	</div>
	{{ Form::submit($text_submit, array('class' => 'btn btn-primary', 'id' => 'submit', 'data-loading-text' => $text_loading)) }}
	{{ HTML::link( URL::to($base . '/'), $text_cancel, array('class' => 'btn btn-default', 'id'=> 'cancel')) }}
{{ Form::close() }}

<script type="text/javascript">
	$('select[name="type"]').on('change', function(){
		$.ajax({
			url: '{{ URL::to($base . '/upload-format') }}',
			type: 'GET',
			data: { type : $(this).val() },
			beforeSend: function() { 
				$('#upload-format').html('...');
			},
			success: function(response) {
				$('#upload-format').html(response);
			}
		});
	});

</script>